package day_2022_12_to_3.year2023;

/**
 * @author haomin
 * @date 2023/01/31 23:44
 **/
public class Day1_31_Num2319 {
    class Solution {
        public boolean checkXMatrix(int[][] grid) {
            int length = grid.length;
            for (int i = 0; i < length; i++) {
                int diff = length - i - 1;
                if (grid[i][i] == 0 || grid[i][diff] == 0) return false;
                for (int j = 0; j < length; j++) {
                    if (j != i && j != diff) {
                        if (grid[i][j] != 0) return false;
                    }
                }
            }
            return true;
        }
    }
}